package com.hlkj.pay.enums;

import com.hlkj.framework.common.valid.IValidEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author HlpayTeam
 * @date 2024/09/06 18:20
 */
public interface AdminUserEnum {
    @Getter
    enum CHANGE_LOG_TYPE {

                        //1 用户 2 角色 3 权限 4 组织
                        USER(1, "用户"),
                        ROLE(2, "角色"),
                        PERMISSION(3, "权限"),
                        ORGANIZATION(4, "组织"),
                        TEAMS(5, "团队") ,

        ;

        /**
         * 错误码
         */
        private Integer code;
        /**
         * 错误提示
         */
        private String  msg;

        CHANGE_LOG_TYPE(Integer code, String msg){
            this.code = code;
            this.msg = msg;
        }
        
        public static CHANGE_LOG_TYPE from(Integer key) {
            CHANGE_LOG_TYPE[] values = CHANGE_LOG_TYPE.values();
            for (CHANGE_LOG_TYPE deliveryType : values) {
                if (deliveryType.getCode().equals(key)) {
                    return deliveryType;
                }
            }
            return CHANGE_LOG_TYPE.USER;
        }
    }

    @Getter
    enum ORGANIZATION_TYPE {

                        HEAD_OFFICE(1, "总部"), PART(2, "部门"), SHOP(99, "门店"),

        ;

        /**
         * 错误码
         */
        private Integer code;
        /**
         * 错误提示
         */
        private String  msg;
    
        ORGANIZATION_TYPE(Integer code, String msg){
            this.code = code;
            this.msg = msg;
        }

        public static ORGANIZATION_TYPE from(Integer key) {
            ORGANIZATION_TYPE[] values = ORGANIZATION_TYPE.values();
            for (ORGANIZATION_TYPE deliveryType : values) {
                if (deliveryType.getCode().equals(key)) {
                    return deliveryType;
                }
            }
            return ORGANIZATION_TYPE.PART;
        }
    }
    @Getter
    enum PERMISSION_TYPE {

                        MODEL(1, "模块"), PAGE(2, "页面"), BUTTON(3, "功能"),

        ;

        /**
         * 错误码
         */
        private Integer code;
        /**
         * 错误提示
         */
        private String  msg;
    
        PERMISSION_TYPE(Integer code, String msg){
            this.code = code;
            this.msg = msg;
        }

        public static PERMISSION_TYPE from(Integer key) {
            PERMISSION_TYPE[] values = PERMISSION_TYPE.values();
            for (PERMISSION_TYPE deliveryType : values) {
                if (deliveryType.getCode().equals(key)) {
                    return deliveryType;
                }
            }
            return PERMISSION_TYPE.BUTTON;
        }
    }
    @Getter
    enum USER_STATUS {
                        ABLE(1, "启用"), ENABLE(0, "禁用"), LEAVE(2, "离职"),

        ;

        /**
         * 错误码
         */
        private Integer code;
        /**
         * 错误提示
         */
        private String  msg;
    
        USER_STATUS(Integer code, String msg){
            this.code = code;
            this.msg = msg;
        }

        public static USER_STATUS from(Integer key) {
            USER_STATUS[] values = USER_STATUS.values();
            for (USER_STATUS deliveryType : values) {
                if (deliveryType.getCode().equals(key)) {
                    return deliveryType;
                }
            }
            return USER_STATUS.ABLE;
        }
    }
    @Getter
    @AllArgsConstructor
     enum AdminAuthCodeEnum implements IValidEnum {
        
        /**
         * 系统来源
         */
        ADMIN_AUTH_CODE_MFA_LOGIN(0, "adminuser:authcode:updatepwd:","多因子认证验证码"),
        ADMIN_AUTH_CODE_FORGET_PWD(1, "adminuser:authcode:forgetpwd:","忘记密码验证码"),
        ADMIN_AUTH_CODE_UPDATE_PWD(2, "adminuser:authcode:updatepwd:","修改密码验证码"),
        ADMIN_AUTH_CODE_LOGIN(3, "adminuser:authcode:login:","用户登录"),
        ADMIN_AUTH_CODE_REGISTER(4, "adminuser:authcode:register:","用户注册"),
        ADMIN_AUTH_CODE_UPDATE_PHONE(5, "adminuser:authcode:updatephone:","修改手机号"),
        ADMIN_AUTH_CODE_UPDATE_TRAN_PWD(6, "adminuser:authcode:updateTranPwd:","修改交易密码"),
        ADMIN_AUTH_CODE_CALL_TRAN_PWD(7, "adminuser:authcode:callTranPwd:","找回交易密码"),
        MERCHANT_PAYMENT(8, "merchant:payment:","商户代付"),
        AUTH_CODE_LOGIN(106, "user:authcode:login:","用户登录"),
        MERCHANT_REGISTER_ACCOUNT(9, "merchant:account:register","商户注册账号密码通知"),
        MERCHANT_RESET_ACCOUNT(10, "merchant:pwd:reset","商户重置密码发送通知"),
        
        
        ;
        
        private Integer code;
        private String redisCachePrefix;
        private String desc;
        public static AdminAuthCodeEnum from(Integer key) {
            AdminAuthCodeEnum[] values = AdminAuthCodeEnum.values();
            for (AdminAuthCodeEnum deliveryType : values) {
                if (deliveryType.getCode().equals(key)) {
                    return deliveryType;
                }
            }
            return AdminAuthCodeEnum.ADMIN_AUTH_CODE_LOGIN;
        }
    }

    
    
  
    
   
    
    @Getter
    enum BEHAVIOR_LOG_TYPE {
        
        CREATION(1, "新增"), QUERY(2, "读"), REDACT(4, "写"), DELETE(8, "删除"),
        ENABLE_CHANGE(16, "启用/停用"),APPROVE(32 , "审批"), ASSIGN(64 , "分派"),DOWNLOAD(128 , "下载"),LOGIN(33, "登录"),
        LOGOUT(34, "登出"),
        
        ;
        
        /**
         * 错误码
         */
        private Integer code;
        /**
         * 错误提示
         */
        private String  msg;
        
        BEHAVIOR_LOG_TYPE(Integer code, String msg){
            this.code = code;
            this.msg = msg;
        }
        
        public static BEHAVIOR_LOG_TYPE from(Integer key) {
            BEHAVIOR_LOG_TYPE[] values = BEHAVIOR_LOG_TYPE.values();
            for (BEHAVIOR_LOG_TYPE deliveryType : values) {
                if (deliveryType.getCode().equals(key)) {
                    return deliveryType;
                }
            }
            return BEHAVIOR_LOG_TYPE.QUERY;
        }
    }
    
   
   
   
}
